package com.hyl.jpademo.dao;

import com.hyl.jpademo.entity.Chance;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/5/25 15:03
 **/
public interface ChanceRepostory extends JpaRepository<Chance,Integer>, JpaSpecificationExecutor<Chance> {

	//根据客户名称和概要，查询销售机会
//	public List<Chance> findChanceByCustNameLikeAndTitleLike(String custname,String title);

	// where custname like ? and title like ?
//	public List<Chance> findByCustNameLikeAndTitleLike(String custname,String title);

	// where title like ? and  custname like ?
//	public List<Chance> findByTitleLikeAndCustNameLike(String title,String custname);


	@Query("Select c from Chance c where c.custName like ?1") //HQL==》操作实体==》类 / 属性
	public List<Chance> findByCustName(String custname);


	@Query(value="Select c.* from sal_chance c where c.chc_title=?1",nativeQuery =true) //原生Sql
	public List<Chance> findByTitle(String title);



}
